#include "mechanicalcoilspectrum.h"
#include "private/mechanicalspectrumprivatedefine.h"
#include "common/dataspecificationutils.h"
#include "common/binaryprocesshelper.h"
#include "common/xmldocument.h"
#include "private/spectrumdatafilecommondefine.h"
#include "common/xmlprocesshelper.h"
#include <QDebug>

namespace DataSpecificationGW
{
    class MechanicalCoilSpectrumPrivate
    {
    public:
        MechanicalCoilExtInformationPrivate m_stMechanicalCoilExtInformationPrivate;
    };

    MechanicalCoilSpectrum::MechanicalCoilSpectrum()
        : MechanicalSpectrum(),
          m_pMechanicalCoilSpectrumPrivate(new MechanicalCoilSpectrumPrivate)
    {
        setSpectrumTypeCode(SPECTRUM_CODE_MECH_ELEC_I);
    }

    MechanicalCoilSpectrum::~MechanicalCoilSpectrum()
    {
    }

    /************************************************
     * 函数名   : spectrumName
     * 输入参数 : NULL
     * 输出参数 : NULL
     * 返回值   : QString
     * 功能     : 图谱名称
     ************************************************/
    QString MechanicalCoilSpectrum::spectrumName() const
    {
        return STR_FILE_NODE_MECHANICAL_COIL;
    }

    /************************************************
     * 函数名   : setMechanicalCoilExtInformation
     * 输入参数 :
       const MechanicalCoilExtInformation& stMechanicalCoilExtInformation: MechanicalCoilExtInformation
     * 输出参数 : NULL
     * 返回值   : void
     * 功能     : 设置MechanicalCoilExtInformation
     ************************************************/
    void MechanicalCoilSpectrum::setMechanicalCoilExtInformation(const MechanicalCoilExtInformation& stMechanicalCoilExtInformation)
    {
        m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.ucMechDataType = stMechanicalCoilExtInformation.eMechDataType;
        m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.ucOperatingMechanismType = stMechanicalCoilExtInformation.eOperatingMechanismType;
        m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.ucMechStoredEnergyType = stMechanicalCoilExtInformation.eMechStoredEnergyType;
        m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fCoilUpTime = stMechanicalCoilExtInformation.fCoilUpTime;
        m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fHitTime = stMechanicalCoilExtInformation.fHitTime;
        m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fAuxSubSwitchCloseTime = stMechanicalCoilExtInformation.fAuxSubSwitchCloseTime;
        m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fCoilDownTime = stMechanicalCoilExtInformation.fCoilDownTime;
        m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fCoilMaxCurrent = stMechanicalCoilExtInformation.fCoilMaxCurrent;
        m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fConversionFactor = stMechanicalCoilExtInformation.fConversionFactor;
    }

    /************************************************
     * 函数名   : getMechanicalCoilExtInformation
     * 输入参数 : NULL
     * 输出参数 :
       MechanicalCoilExtInformation& stMechanicalCoilExtInformation: MechanicalCoilExtInformation
     * 返回值   : void
     * 功能     : 获取MechanicalCoilExtInformation
     ************************************************/
    void MechanicalCoilSpectrum::getMechanicalCoilExtInformation(MechanicalCoilExtInformation& stMechanicalCoilExtInformation)
    {
        stMechanicalCoilExtInformation.eMechDataType = static_cast<MechDataType>(m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.ucMechDataType);
        stMechanicalCoilExtInformation.eOperatingMechanismType = static_cast<OperatingMechanismType>(m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.ucOperatingMechanismType);
        stMechanicalCoilExtInformation.eMechStoredEnergyType = static_cast<MechStoredEnergyType>(m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.ucMechStoredEnergyType);
        stMechanicalCoilExtInformation.fCoilUpTime = m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fCoilUpTime;
        stMechanicalCoilExtInformation.fHitTime = m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fHitTime;
        stMechanicalCoilExtInformation.fAuxSubSwitchCloseTime = m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fAuxSubSwitchCloseTime;
        stMechanicalCoilExtInformation.fCoilDownTime = m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fCoilDownTime;
        stMechanicalCoilExtInformation.fCoilMaxCurrent = m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fCoilMaxCurrent;
        stMechanicalCoilExtInformation.fConversionFactor = m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fConversionFactor;
    }

    /************************************************
     * 函数名   : saveBinarySpectrumExtInfo
     * 输入参数 :
       QDataStream& out: 输出流
     * 输出参数 : NULL
     * 返回值   : bool
     * 功能     : 保存二进制可扩展信息段
     ************************************************/
    bool MechanicalCoilSpectrum::saveBinarySpectrumExtInfo(QDataStream& out)
    {
        MechanicalSpectrum::saveBinarySpectrumExtInfo(out);

        out.device()->seek(MECH_COMMON_LENGTH);

        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipMechDataType) out << m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.ucMechDataType;
        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipOperatingMechanismType) out << m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.ucOperatingMechanismType;
        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipMechStoredEnergyType) out << m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.ucMechStoredEnergyType;
        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipCoilUpTime) out << m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fCoilUpTime;
        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipHitTime) out << m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fHitTime;
        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipAuxSubSwitchCloseTime)out << m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fAuxSubSwitchCloseTime;
        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipCoilDownTime) out << m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fCoilDownTime;
        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipCoilMaxCurrent) out << m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fCoilMaxCurrent;
        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipConversionFactor) out << m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fConversionFactor;

        return true;
    }

    /************************************************
     * 函数名   : saveXMLSpectrumExtInfo
     * 输入参数 :
       XMLDocument& xmlDocumentObj: xml文档对象
       QDomElement& element: dom元素
     * 输出参数 : NULL
     * 返回值   : bool
     * 功能     : 保存XML可扩展信息段
     ************************************************/
    bool MechanicalCoilSpectrum::saveXMLSpectrumExtInfo(XMLDocument& xmlDocumentObj, QDomElement& element)
    {
        MechanicalSpectrum::saveXMLSpectrumExtInfo(xmlDocumentObj, element);

        xmlDocumentObj.beginElement(element);
        xmlDocumentObj.beginElement(STR_SPECTRUM_NODE_EXTINFORMATION);

        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipMechDataType) xmlDocumentObj.setValue(TEXT_MECH_DATA_TYPE, QString::number(m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.ucMechDataType));
        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipOperatingMechanismType) xmlDocumentObj.setValue(TEXT_MECH_FUNCTION_TYPE, QString::number(m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.ucOperatingMechanismType));
        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipMechStoredEnergyType) xmlDocumentObj.setValue(TEXT_MECH_STORAGE_TYPE, QString::number(m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.ucMechStoredEnergyType));
        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipCoilUpTime) xmlDocumentObj.setValue(TEXT_COIL_UP_TIME, QString::number(m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fCoilUpTime, 'f', 1));
        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipHitTime) xmlDocumentObj.setValue(TEXT_HIT_TIME, QString::number(m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fHitTime, 'f', 1));
        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipAuxSubSwitchCloseTime) xmlDocumentObj.setValue(TEXT_AUX_SUB_SWITCH_CLOSE_TIME, QString::number(m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fAuxSubSwitchCloseTime, 'f', 1));
        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipCoilDownTime) xmlDocumentObj.setValue(TEXT_COIL_DOWN_TIME, QString::number(m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fCoilDownTime, 'f', 1));
        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipCoilMaxCurrent) xmlDocumentObj.setValue(TEXT_COIL_MAX_CURRENT, QString::number(m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fCoilMaxCurrent, 'f', 1));
        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipConversionFactor) xmlDocumentObj.setValue(TEXT_CONVERSION_FACTOR, QString::number(m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fConversionFactor, 'f', 4));

        return true;
    }

    /************************************************
     * 函数名   : saveJSONSpectrumExtInfo
     * 输入参数 :
       rapidjson::Document::AllocatorType& alloc:
       rapidjson::Value& jsonValue: json数据
     * 输出参数 : NULL
     * 返回值   : bool
     * 功能     : 保存JSON可扩展信息段
     ************************************************/
    bool MechanicalCoilSpectrum::saveJSONSpectrumExtInfo(rapidjson::Document::AllocatorType& alloc, rapidjson::Value& jsonValue)
    {
        MechanicalSpectrum::saveJSONSpectrumExtInfo(alloc, jsonValue);

        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipMechDataType) saveJSONField(m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.ucMechDataType, TEXT_MECH_DATA_TYPE, alloc, jsonValue);
        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipOperatingMechanismType) saveJSONField(m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.ucOperatingMechanismType, TEXT_MECH_FUNCTION_TYPE, alloc, jsonValue);
        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipMechStoredEnergyType) saveJSONField(m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.ucMechStoredEnergyType, TEXT_MECH_STORAGE_TYPE, alloc, jsonValue);
        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipCoilUpTime) saveJSONField(m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fCoilUpTime, TEXT_COIL_UP_TIME, alloc, jsonValue);
        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipHitTime) saveJSONField(m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fHitTime, TEXT_HIT_TIME, alloc, jsonValue);
        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipAuxSubSwitchCloseTime) saveJSONField(m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fAuxSubSwitchCloseTime, TEXT_AUX_SUB_SWITCH_CLOSE_TIME, alloc, jsonValue);
        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipCoilDownTime) saveJSONField(m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fCoilDownTime, TEXT_COIL_DOWN_TIME, alloc, jsonValue);
        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipCoilMaxCurrent) saveJSONField(m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fCoilMaxCurrent, TEXT_COIL_MAX_CURRENT, alloc, jsonValue);
        if (!m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipConversionFactor) saveJSONField(m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fConversionFactor, TEXT_CONVERSION_FACTOR, alloc, jsonValue);
        return true;
    }

    /************************************************
     * 函数名   : parseBinarySpectrumExtInfo
     * 输入参数 :
       QDataStream& in: 输入流
     * 输出参数 : NULL
     * 返回值   : bool
     * 功能     : 解析二进制可扩展信息段
     ************************************************/
    bool MechanicalCoilSpectrum::parseBinarySpectrumExtInfo(QDataStream& in)
    {
        MechanicalSpectrum::parseBinarySpectrumExtInfo(in);

        if (!in.device()->seek(MECH_COMMON_LENGTH))
        {
            qDebug() << "MechanicalCoilSpectrum::parseBinarySpectrumExtInfo failed";
            return false;
        }

        parseBinaryField(in, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipMechDataType, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.ucMechDataType, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHasMechDataType);
        parseBinaryField(in, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipOperatingMechanismType, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.ucOperatingMechanismType, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHasOperatingMechanismType);
        parseBinaryField(in, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipMechStoredEnergyType, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.ucMechStoredEnergyType, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHasMechStoredEnergyType);
        parseBinaryField(in, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipCoilUpTime, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fCoilUpTime, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHasCoilUpTime);
        parseBinaryField(in, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipHitTime, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fHitTime, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHaHitTime);
        parseBinaryField(in, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipAuxSubSwitchCloseTime, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fAuxSubSwitchCloseTime, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHasAuxSubSwitchCloseTime);
        parseBinaryField(in, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipCoilDownTime, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fCoilDownTime, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHasCoilDownTime);
        parseBinaryField(in, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipCoilMaxCurrent, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fCoilMaxCurrent, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHasCoilMaxCurrent);
        parseBinaryField(in, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bSkipConversionFactor, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fConversionFactor, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHasConversionFactor);

        return in.status() == QDataStream::Ok;
    }

    /************************************************
     * 函数名   : parseXMLSpectrumExtInfo
     * 输入参数 :
       XMLDocument& xmlDocumentObj: xml文档对象
     * 输出参数 : NULL
     * 返回值   : bool
     * 功能     : 解析XML可扩展信息段
     ************************************************/
    bool MechanicalCoilSpectrum::parseXMLSpectrumExtInfo(XMLDocument& xmlDocumentObj)
    {
        MechanicalSpectrum::parseXMLSpectrumExtInfo(xmlDocumentObj);

        xmlDocumentObj.beginElement(spectrumName());
        xmlDocumentObj.beginElement(STR_SPECTRUM_NODE_EXTINFORMATION);       

        parseXMLField(xmlDocumentObj, TEXT_MECH_DATA_TYPE, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.ucMechDataType, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHasMechDataType);
        parseXMLField(xmlDocumentObj, TEXT_MECH_FUNCTION_TYPE, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.ucOperatingMechanismType, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHasOperatingMechanismType);
        parseXMLField(xmlDocumentObj, TEXT_MECH_STORAGE_TYPE, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.ucMechStoredEnergyType, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHasMechStoredEnergyType);
        parseXMLField(xmlDocumentObj, TEXT_COIL_UP_TIME, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fCoilUpTime, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHasCoilUpTime);
        parseXMLField(xmlDocumentObj, TEXT_HIT_TIME, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fHitTime, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHaHitTime);
        parseXMLField(xmlDocumentObj, TEXT_AUX_SUB_SWITCH_CLOSE_TIME, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fAuxSubSwitchCloseTime, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHasAuxSubSwitchCloseTime);
        parseXMLField(xmlDocumentObj, TEXT_COIL_DOWN_TIME, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fCoilDownTime, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHasCoilDownTime);
        parseXMLField(xmlDocumentObj, TEXT_COIL_MAX_CURRENT, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fCoilMaxCurrent, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHasCoilMaxCurrent);
        parseXMLField(xmlDocumentObj, TEXT_CONVERSION_FACTOR, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fConversionFactor, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHasConversionFactor);

        xmlDocumentObj.endElement();
        xmlDocumentObj.endElement();

        return true;
    }

    /************************************************
     * 函数名   : parseJSONSpectrumExtInfo
     * 输入参数 :
       const rapidjson::Value& jsonValue: json数据
     * 输出参数 : NULL
     * 返回值   : bool
     * 功能     : 解析JSON可扩展信息段
     ************************************************/
    bool MechanicalCoilSpectrum::parseJSONSpectrumExtInfo(const rapidjson::Value& jsonValue)
    {
        MechanicalSpectrum::parseJSONSpectrumExtInfo(jsonValue);

        parseJSONField(jsonValue, TEXT_MECH_DATA_TYPE, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.ucMechDataType, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHasMechDataType);
        parseJSONField(jsonValue, TEXT_MECH_FUNCTION_TYPE, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.ucOperatingMechanismType, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHasOperatingMechanismType);
        parseJSONField(jsonValue, TEXT_MECH_STORAGE_TYPE, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.ucMechStoredEnergyType, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHasMechStoredEnergyType);
        parseJSONField(jsonValue, TEXT_COIL_UP_TIME, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fCoilUpTime, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHasCoilUpTime);
        parseJSONField(jsonValue, TEXT_HIT_TIME, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fHitTime, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHaHitTime);
        parseJSONField(jsonValue, TEXT_AUX_SUB_SWITCH_CLOSE_TIME, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fAuxSubSwitchCloseTime, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHasAuxSubSwitchCloseTime);
        parseJSONField(jsonValue, TEXT_COIL_DOWN_TIME, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fCoilDownTime, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHasCoilDownTime);
        parseJSONField(jsonValue, TEXT_COIL_MAX_CURRENT, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fCoilMaxCurrent, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHasCoilMaxCurrent);
        parseJSONField(jsonValue, TEXT_CONVERSION_FACTOR, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.fConversionFactor, m_pMechanicalCoilSpectrumPrivate->m_stMechanicalCoilExtInformationPrivate.bHasConversionFactor);

        return true;
    }

}
